package com.sirap.spring.boot.demo.controller.album;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sirap.basic.tool.D;
import com.sirap.basic.util.StrUtil;
import com.sirap.fish.fetchers.SinaSportsImageFetchers;

@Controller
@RequestMapping(value = "/albumsinasports")
public class AlbumSinaSportsController extends TopAlbumController {

	@Override
	@RequestMapping(value = "/list")
	public String listAlbums(HttpServletRequest request, HashMap<String, Object> map) {
		D.at();
		
		return StrUtil.occupy("album/album{0}List", type());
	}

	@Override
	@ResponseBody
    @RequestMapping(value = "/page/{page}")
	public Map<String, Object> getAlbumsByPage(@PathVariable int page, HttpServletRequest request) {
    	D.at();
		Map<String, Object> map = SinaSportsImageFetchers.getAlbumsByPage(page);
		D.pjsp(map);
	
		return map;
	}
	
	@Override
	@RequestMapping(value = "/show/{base64url}")
	public String showAlbum(HttpServletRequest request, @PathVariable String base64url, HashMap<String, Object> map) {
		D.at();
		map.putAll(getAlbumDetail(base64url, SinaSportsImageFetchers.class));
	
		return StrUtil.occupy("album/album{0}Detail", type());
	}
}
